-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use connected faces from generated convex hull #80
Conversation
isaac-mason
commented
Aug 15, 2022
•
edited
Loading
edited
- Use connected faces from generated convex hull
- Fixes Physics simulation stops when generated convex hulls collide #76
- Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es
- Using the generated faces in ConvexHull addresses this
- Inspiration taken from discussion in cannon-es repo
- Simplify ConvexPolyhedron creation pmndrs/cannon-es#103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Gathering connected faces from the hull sounds good to me, but had a few questions on how we gather the vertex positions here.
b46dec9
to
063198a
Compare
Codecov Report
@@ Coverage Diff @@
## main #80 +/- ##
==========================================
+ Coverage 77.94% 79.74% +1.80%
==========================================
Files 3 3
Lines 1904 1940 +36
Branches 46 45 -1
==========================================
+ Hits 1484 1547 +63
+ Misses 420 393 -27
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Updated to address comments. This approach reverts back to using I'll give this another pass shortly - and any feedback would be appreciated 🙂 |
03c543f
to
0d97b62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow reply here! Just had some questions on collectFacesAndVertices
.
Motivation: - Generated convex hulls did not have connected faces, which is required for convex-convex collision in cannon-es - Using the connected faces generated by ConvexHull addresses this - Fixes donmccurdy#76
0d97b62
to
3a13f24
Compare
Sorry, was busy for a sec! 🙂 Marking as ready for review now. I've done some testing and this PR looks good to go. As an aside, the generated shapes are now returning less vertices. Take this snippet as an example:
With the existing implementation, the generated hull had 1170 vertices. With the new implementation, the generated hull had 213 vertices. Also, something appears to be indeterministic - the number of faces and vertices vary in both the existing and new implementations on each run. I'm not going to address that in this PR though. |
Thank you! Will do another review pass soon.
The vertex positions displaced by small random amounts, here: Lines 246 to 255 in f570a1c
This may be the cause. If I remember correctly, it's a simple way to avoid edge cases we would otherwise need to deal with in the convex hull algorithm, related to co-planar points. Not a problem, for our purposes! |
Ah that looks like it, thanks. And yep, not really a big issue when cannon itself isn't deterministic! |
Thanks so much @isaac-mason! I've merged the changes and published v4.3.0. |
Thanks for the help @donmccurdy! |